# dpkg_1.14.29.tar.gz
# Builds from https://github.com/puppylinux-woof-CE/petbuilds
# File auto generated by ./mk_petbuild.sh. Edit as necessary.

. ../func
. ../build.conf

URL=http://ftp.de.debian.org/debian/pool/main/d/dpkg
SPKG=dpkg
PKG=dpkg-deb
VER=1.18.9
COMP=tar.xz
DESC="Debian packaging tool"
DEPS=
CAT=BuildingBlock
DESKTOP=dpkg.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	mv ${SPKG}-${VER} ${PKG}-${VER} 
	cd ${PKG}-${VER}
	./configure \
		--prefix=/usr \
		--libdir=/usr/${LIBDIR} \
		--sysconfdir=/etc \
		--localstatedir=/var
	make $MKFLG || exit 1
	make DESTDIR=${CWD}/${PKG}-install install
	rm -rf  ${CWD}/${PKG}-install/{var,etc}
	rm -rf  ${CWD}/${PKG}-install/usr/{${LIBDIR},include,sbin,share}
	for e in `ls ${CWD}/${PKG}-install/usr/bin|grep -v 'dpkg\-deb'`;do
		rm ${CWD}/${PKG}-install/usr/bin/${e}
	done
	strip --strip-unneeded ${CWD}/${PKG}-install/usr/bin/dpkg-deb
	cd -
}
# main
retrieve ${SPKG}_${VER}.${COMP}
extract ${SPKG}_${VER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
